package com.company.jee.common.utilities;

/**
 * Clase encargada de validar argumentos
 * 
 * @author Luis Felipe Sosa
 */
public abstract class Assert {

	public Assert() {
	}

	public static void isNotNull(Object object) {
		isNotNull(object, "");
	}

	public static void isNotNull(Object object, String message) {
		if (object == null)
			throw new IllegalArgumentException(message);
		else
			return;
	}

	public static void isTrue(boolean expression) {
		isTrue(expression, "");
	}

	public static void isTrue(boolean expression, String message) {
		if (!expression)
			throw new IllegalArgumentException(message);
		else
			return;
	}

	public static void isTrue(String expression) {
		System.out.println((new StringBuilder()).append(
				"------>>  expression == ").append(expression).toString());
		if (!expression.equals("true"))
			throw new IllegalArgumentException(expression);
		else
			return;
	}

	public String toString() {
		return super.toString();
	}

	public static final boolean ON = true;
}